Skip to content

fix(amicode): superseded receipts render their captured diff, not the live view - #74

Merged
jack-champagne merged 1 commit into
local/amicodefrom
fix/amicode-receipt-currency
Jul 29, 2026
Merged

fix(amicode): superseded receipts render their captured diff, not the live view#74
jack-champagne merged 1 commit into
local/amicodefrom
fix/amicode-receipt-currency

Conversation

@aarontrowbridge

Copy link
Copy Markdown
Member

Fixes the repeating-formulation-card behaviour, and a worse bug hiding behind it.

The defect

INLINE_KINDS membership was necessary and sufficient for a receipt to render the full entity view inline — and that view reads amicodeProblemView(), the live problem view, rather than a snapshot at the receipt's own seq. Two consequences:

  1. N updates to one entity painted N identical copies of the present. Three formulation edits produced three full cards showing the same current state, so the transcript looked like a history and carried none. This is the visible annoyance.
  2. Switching problems mid-chat retroactively rewrote the transcript. message-timeline.tsx fetches the problem with no ?slug=, and ~/.amico/problems/active is a single global file — so scrolling back to a GHZ formulation after switching to a transmon problem showed the transmon one.

(2) matters more than (1) and is invisible until you hit it. It also breaks any future history-bearing card.

The fix

New pure module receipt-currency.ts: is this receipt the current state of the active problem? Only the current one renders live; everything else falls through to the existing Chip, which already renders from the captured AMICODE_DIFF sentinel. Kept out of card.tsx so it is testable without rendering anything.

Deliberately permissive where currency is ambiguous — a kind with no events yet stays live. The original gate note in card.tsx warns that "a record+update lands as two events but one receipt, and the view can lag a beat, so tighter gates hid the view entirely," and that warning still holds.

Verification

packages/ui 336 pass (325 baseline + 11 new), tsgo --noEmit clean. Rebased onto local/amicode after #65#72; zero overlap with those files.

Why this is separate from the warrant work

It is an independent defect fix with no dependency on the deliberation-layer feature branch, and with a hackathon coming it should be mergeable on its own. The feature work that builds on it is #feat/amicode-approval-surfaces.

Design context: spec-20260727-164748-amicode-deliberation-layer-capability-warrants §9.4.

🤖 Generated with Claude Code

…view

Spec-20260727-164748 §9.4 / plan task S1.

Kind membership in INLINE_KINDS was necessary AND sufficient for a receipt
to render the full entity view inline, and that view reads the LIVE problem
view rather than a snapshot at the receipt's own seq. Two defects followed:

  1. N updates to one entity painted N identical copies of the present, so
     the transcript looked like a history and carried none. This is the
     repeating-formulation-card complaint.
  2. The transcript fetches the globally-active problem with no ?slug=, and
     ~/.amico/problems/active is a single global file — so switching problems
     mid-chat retroactively rewrote every earlier receipt to the new problem.

Adds receipt-currency.ts: a pure predicate for "is this receipt the current
state of the active problem", kept out of card.tsx so it is testable without
rendering. Only the current receipt renders live; the rest fall through to the
existing Chip, which already renders from the captured AMICODE_DIFF sentinel.

Deliberately permissive where currency is ambiguous — a kind with no events
yet stays live — preserving the original gate note's warning that a
record+update lands as two events but one receipt and the view can lag.

packages/ui: 336 pass (325 baseline + 11 new), tsgo --noEmit clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jack-champagne
jack-champagne force-pushed the fix/amicode-receipt-currency branch from 78ee045 to 7639a8f Compare July 28, 2026 22:52
@jack-champagne
jack-champagne merged commit 42ecbab into local/amicode Jul 29, 2026
2 of 5 checks passed
@aarontrowbridge
aarontrowbridge deleted the fix/amicode-receipt-currency branch August 2, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants